package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.ProjectInfoDao;
import cn.topevery.garden.entity.po.ProjectInfo;
import cn.topevery.garden.entity.query.ProjectInfoQuery;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 *
 * @author code-generate
 * @date 2021-09-01
 */
@Service
public class ProjectInfoLogic extends BaseLogic<ProjectInfo> {
    @Autowired
    ProjectInfoDao projectInfoDao;

    @Override
    public BaseEntityDao<ProjectInfo, Integer> getDao() {
        return projectInfoDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<ProjectInfo> listPage(ProjectInfoQuery query) {
        return projectInfoDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        projectInfoDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param projectInfo 实体
     */
    public boolean saveOrUpdate(String userId, ProjectInfo projectInfo){
        projectInfoDao.saveOrUpdate(userId,projectInfo);
        return true;
    }

    public boolean isExit(String fieldName, String value){
        return projectInfoDao.isExit(fieldName, value);
    }
}
